/******************************************************************************* 
 * Copyright (C) 2012-2015 Microfountain Technology, Inc. All Rights Reserved. 
 * 
 * Unauthorized copying of this file, via any medium is strictly prohibited.   
 * Proprietary and confidential
 * 
 * Last Modified: 2015-11-25 14:53:22
 ******************************************************************************/
package cn.com.xy.sms.util;

import java.util.Map;

import org.json.JSONObject;

import android.content.Context;
import cn.com.xy.sms.sdk.dex.DexUtil;

/***
 * 解析手表管理
 * 
 * @author Administrator
 * 
 */
public class ParseWatchManager {
    /**
     * 解析短信创建手表
     * 
     * @param ctx
     *            上下文
     * @param phoneNumber
     *            短信接入码即短信发送方号码
     * @param smsCenterNum
     *            短信中心号码,短信发送方的短信中心.接收短信时可以解析到此中心号码值
     * @param smsContent
     *            短信内容
     * @param extend
     * @return Map key:Result value false或true
     */
    public static JSONObject parseMsgForWatch(Context ctx, String phoneNumber, String smsCenterNum, String smsContent, Map<String, String> extend) throws Exception {
        if (ctx == null) {
            throw new Exception(" Context is null.");
        }

        if (phoneNumber == null) {
            throw new Exception(" phoneNumber is null.");
        }
        if (smsContent == null) {
            throw new Exception(" smsContent is null.");
        }

        Map<String, Object> res = ParseManager.parseMsg(ctx, phoneNumber, smsCenterNum, smsContent, 0l, extend);
        JSONObject map = null;
        if (res != null && ParseBubbleManager.getParseStatu(res) != -1) {
            map = DexUtil.handerWatchValueMap(res);
        }
        return map;
    }
}
